package com.yanqu.road.server.cmd.activity.tongbing;

import com.yanqu.road.pb.activity.TongBingProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.tongbing.CrossTongBingMgr;
import com.yanqu.road.server.manager.activity.tongbing.activity.CrossTongBingActivity;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C2_CROSS_TONG_BING_CALL_SOLDIER, desc = "")
public class CrossTongBingCallSoldierCmd extends CrossUnionCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        TongBingProto.CrossTongBingRecruitSoldierReqMsg reqMsg = TongBingProto.CrossTongBingRecruitSoldierReqMsg.parseFrom(packet.getBytes());
        CrossTongBingActivity activity = CrossTongBingMgr.getActivity(reqMsg.getActivityId(), groupId);
        activity.setLastReqTime(packet.getPlayerId());
        if (reqMsg.getReqType() == 1) {
            activity.recruitSoldier(serverId, packet.getPlayerId(), reqMsg);
        } else {
            activity.recruitSoldierSliver(serverId, packet.getPlayerId(), reqMsg);
        }
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

    }

    @Override
    public void sendData() {

    }
}
